<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
.str{
	color:#676A6C;
	font-weight:normal;
}
.search-result p{
	margin-bottom:7px;
}
.right-pic{
	float:right;
	min-height: 100px;
	margin-right: 60px;
	margin-top:15px;
}
#list{
font-family:'PingFang SC', 'Helvetica Neue', 'Helvetica', 'STHeitiSC-Light', 'Arial', sans-serif;
}

</style>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>专利·数据工厂</title>
    <link href="${pageContext.request.contextPath }/img/webLogoIcon.png"
          rel="shortcut icon">
    <link href="${pageContext.request.contextPath }/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/font-awesome.css"
          rel="stylesheet">

    <link href="${pageContext.request.contextPath }/css/animate.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/style.css"
          rel="stylesheet">


    <!-- FooTable -->
    <link href="${pageContext.request.contextPath }/css/footable.core.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/datepicker3.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/mypage.css"
          rel="stylesheet">
          <link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet" />
    <style>
        .select2_demo_1 {
            float: left;
            width: 120px;
            display: inline;
            margin-left: 10px;
        }

        .form-control {
            display: inline;
        }

        .col-sm-3 {
            float: right;
            width: 560px;
        }

        .input-group {
            float: right;
            width: 240px;
            margin-left: 5px;
        }

        table {
            table-layout: fixed;
        }

        td {
            vertical-align: middle;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;

        }
    </style>

</head>

<body>

<div id="wrapper">

    <nav class="navbar-default navbar-static-side" role="navigation">
        <%
            request.setAttribute("LEFT", "toKnowledgePage");
        %>
        <jsp:include page="../components/left.jsp" flush="true"/>
    </nav>

    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom m-b-20">
            <jsp:include page="../components/head.jsp" flush="true"/>
        </div>
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-9">
                <h2>专利</h2>
                <ol class="breadcrumb">
                    <li class="nav-main1"><a
                            href="${pageContext.request.contextPath}/admin/tosystem_overview">主页</a>
                    </li>
                    <li class="nav-main2"><a id="navigation1" href="#">知识产权</a></li>
                    <li class="active"><a>专利</a></li>
                </ol>
            </div>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
					<div class="ibox float-e-margins barcontent" id="barcontent"></div>
                    <div class="ibox float-e-margins">
                    
                        <!-- <div class="mainSearch">
                            类型：
                            <select id="patentType" onchange="sendKnowledgeListData()">
                                		<option value="" selected>不限</option>
                                        <option value="交易平台">交易公告</option>
                                        <option value="成交公示">成交公示</option>
                                        <option value="挂牌披露">挂牌披露</option>
                                        <option value="招标/资审公告">招标/资审公告</option>
                                        <option value="开标记录">开标记录</option>
                                        <option value="交易结果公示">交易结果公示</option>
                                        <option value="交易结果公示">招标/资审文件澄清</option>
                            </select>
                            <input type="text" id="searchText" placeholder="输入关键词进行搜索">
                            <i id="search" class="fa fa-search"></i>
                        </div> -->
                        <%-- <div class="ibox-content">
                            <div class="table-responsive">
                                <table class="table table-striped">
                                    <!-- <thead>
                                    <tr>
                                        <th>图片地址</th>
                                        <th>发明名称</th>
                                        <th>分类号</th>
                                        <th>主分类号</th>
                                        <th>发明人</th>
                                        <th>地址</th>
                                        <th>下载地址</th>
                                        <th>申请人</th>
                                        <th>申请号</th>
                                        <th>申请日</th>
                                        <th>公开日</th>
                                        <th>公开号</th>
                                        <th>原文地址</th>
                                        <th>类型</th>
                                    </tr>
                                    </thead> -->
                                   <!--  <tbody id="tbody"> -->
                                    <c:forEach items="${biddingList.list}" var="bid">
                                    <tr>
                                    <td>${bid.publish_date}</td>
                                    <td>${bid.datasource}</td>
                                    <td>${bid.province}</td>
                                    <td>${bid.city}</td>
                                    <td>${bid.sourceplatform}</td>
                                    <td>${bid.businessType}</td>
                                    <td>${bid.informationtype}</td>
                                    <td>${bid.industry}</td>
                                    <td>${bid.title}</td>
                                    &lt;%&ndash; <td>${bid.detailurl}</td> &ndash;%&gt;
                                    <td>${bid.numberid}</td>
                                    &lt;%&ndash; 	<td>${bid.originalwebsite}</td> &ndash;%&gt;
                                    <td>${bid.biaoprice}</td>
                                    </tr>
                                    </c:forEach>
                                   <!--  </tbody> -->
                                    <tfoot>
                                    <tr>
                                        <td colspan="11" id="fenyes">
                                                <c:if test="${invites.pageCount>0}">
                                            <div class="box" id="box" style="float: right;"></div>
                                                </c:if>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div> --%>
                        
                        
                        <div class="ibox-content">
                        <div class="input-select" style="margin-bottom: 20px">
	                               		<div class="input-selectbox">
                                            <button data-toggle="dropdown" class="btn btn-primary dropdown-toggle" type="button"  aria-expanded="false">
                                            <i class="fa fa-bars"></i>
                                            <span id="inputSelected">全部</span></button>
                                            <ul class="dropdown-menu" id="selectlist">
                                            	<li><a onclick="setselect(this)">全部</a></li>
                                                <li><a onclick="setselect(this)">专利名称</a></li>
                                                <li><a onclick="setselect(this)">公开号</a></li>
                                            </ul>
	                                        <input type="text" class="form-control" style="width:440px;padding-right: 42px;">
	                                        <i id="gosearch" class="fa fa-search cursearch" onclick="search()"></i>
	                                    </div>
	                                </div>
                            <div class="row m-t-sm">
                                <div class="col-lg-12">
                                <div class="panel blank-panel">
                                <div class="panel-body">
                                <div class="tab-content">
                                <div class="tab-pane active" id="tab-1">
                                    <div class="feed-activity-list" id="list">
                                    	<!--<div class="feed-element" >
				                           <div class="search-result" >
					                           	 <div style="float:left;padding:0 0 0 20px;">
							                   		<h3 style="margin-bottom: 10px;font-size: 23px;"><a target="_blank" href="" style="color:#5A98DE;">Ornithine aspartate</a></h3>
							                   		<p style="font-size:14px;">
							                   			<strong class="str">Accession Number:&nbsp;</strong><span class="ti">DBSALT002898  (DB15577)</span>
							                   		</p>
							                   		<p style="font-size:14px">
							                   			<strong class="str">Chemical formula:&nbsp;</strong><span class="ti">C9H19N3O6</span>
							                   		</p>
							                   		<p style="font-size:14px">
							                   			<strong class="str">Weight:&nbsp;</strong><span  class="ti">Average: 265.266</span>
							                   		</p>
							                   		<p style="font-size:14px">
							                   			<strong class="str">Monoisotopic:&nbsp;</strong><span  class="ti">890.2822346</span> 
							                   		</p>
						                   		</div> 
						                   	</div>
						                   	
					                	</div>-->
                                    </div>
                                    
                                    <div class="feed-activity-list" id="logs">
                                    	<div class="box" id="box" style="float: right;"></div>
                                    </div>
                                </div>
                                </div>
                                </div>
                                </div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
        <jsp:include page="../components/footer.jsp" flush="true"/>
    </div>
</div>

<!-- Mainly scripts -->
<script src="${pageContext.request.contextPath }/js/jquery-2.1.1.js"></script>
<script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath }/js/jquery.metisMenu.js"></script>
<script src="${pageContext.request.contextPath }/js/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="${pageContext.request.contextPath }/js/inspinia.js"></script>
<script src="${pageContext.request.contextPath }/js/pace.min.js"></script>
<!-- FooTable -->
<script src="${pageContext.request.contextPath }/js/footable.all.min.js"></script>
<script src="${pageContext.request.contextPath}/js/mypage.js"></script>
<script src="${pageContext.request.contextPath}/js/plugins/toastr/toastr.min.js"></script>
<script src="${pageContext.request.contextPath}/js/userCustom.js"></script>
<script src="${pageContext.request.contextPath}/js/anychart-base.min.js"></script>

<!-- Page-Level Scripts -->
<script>
    $(document).ready(function () {
        sendTypeInfo();
        sendListData("", 1);
    });

    // 请求类型数据
    function sendTypeInfo() {
        $.ajax({
            url: "${pageContext.request.contextPath}/knowledge/getKnowledgeTypeList",
            type: "get",
            dataType: "json",
            success: function (res) {
                console.log("请求类型数据成功");
                console.log(res);
                groupTypeData(res);
            },
            error: function (err) {
                console.log("请求类型数据失败");
                console.log(err);
            }
        });
    }

    function setselect(that){
    	classification = $(that).text();
		$('#inputSelected').html(classification)
    }
    
    // 组装类型数据
    function groupTypeData(res) {
        let resObj = JSON.parse(res);
        let str = '';
        for (let i = 0; i <= resObj.length; i++) {
            if (i == 0) {
                str += '<option value="不限">不限</option>'
            } else {
                let obj = resObj[i - 1];
                let key = obj.key;
                let doc_count = obj.doc_count;
                str += '<option value="' + key + '">' + key + '</option>'
            }
        }
        $("#patentType").html(str);
    }

    // 请求列表数据
    function sendKnowledgeListData() {
        let typeName = $("#patentType option:selected").text();
        if (typeName == "不限") {
            typeName = "";
        }
        sendListData(typeName, 1);
    }

    // 请求列表数据
    function sendListData(typeName, pageNum) {
        $.ajax({
            url: "${pageContext.request.contextPath}/knowledge/getKnowledgeList",
            type: "get",
            dataType: "json",
            data: {
                typeName: typeName,
                pageNum: pageNum
            },
            success: function (res) {
                console.log("请求列表数据成功");
                console.log(res);
                groupList(res);
            },
            error: function (err) {
                console.log("请求列表数据失败");
                console.log(err);
            }
        });
    }

    // 组装列表数据
    function groupList(res) {
    	
        let resObj = JSON.parse(res);
        let totalData = resObj.totalData;
        let totalPage = resObj.totalPage;
        let pagenum = resObj.pagenum;
        let list = resObj.list;
        paging(totalData, totalPage, pagenum);
        let StrAll = '';
        for (let i = 0; i < list.length; i++) {
            let obj = list[i];
            let openDay = obj.openDay;
            let title = obj.title;
            let type = obj.type;
            let source_url = obj.source_url;
            let number = obj.number;
            let applyDay = obj.applyDay;
            let applyMark = obj.applyMark;
            let downLoadUrl = obj.downLoadUrl;
            let create_time = obj.create_time;
            let proposerZh = obj.proposerZh;
            let proposerEn = obj.proposerEn;
            let inventorZh = obj.inventorZh;
            let inventorEn = obj.inventorEn;
            let openNumber = obj.openNumber;
            let numberMain = obj.numberMain;
            let imgUrl = obj.imgUrl;
            let adress = obj.adress;
            let article_public_id = obj.article_public_id;
            applyDay=/\d{4}-\d{1,2}-\d{1,2}/g.exec(applyDay);
            openDay=/\d{4}-\d{1,2}-\d{1,2}/g.exec(openDay);
            if (proposerZh==undefined||proposerZh==""){
                proposerZh = proposerEn;
            }

            /* if (inventorZh==undefined||inventorZh==""){
                inventorZh = inventorEn;
            } */
            if (typeof inventorZh=="undefined"){
            	inventorZh = "";
            }

            if (openNumber==undefined || openNumber==""){
                openNumber = "暂无数据";
            }
            let detailUrl = "${pageContext.request.contextPath}/knowledge/toKnowledgeDetailPage?article_public_id=" + article_public_id

			var conhtml='<div class="feed-element"><div class="search-result" ><div style="float:left;padding:0 0 0 20px;">'+
           		'<h3 style="margin-bottom: 10px;font-size: 19px;font-weight:100"><a target="_blank" href="'+detailUrl+'" style="color:#2f4050;font-size:16px;font-weight:600">'+title+'</a></h3>'+
           		'<div style="width:200px;float:left;"><p style="font-size:14px;">'+
           			'<strong class="str">发明人:&nbsp;</strong><span class="ti">'+inventorZh+'</span>'+
           		'</p>'+
           		'<p style="font-size:14px">'+
           			'<strong class="str">申请号:&nbsp;</strong><span class="ti">'+applyMark+'</span>'+
           		'</p>'+
           		'<p style="font-size:14px">'+
           			'<strong class="str">公开日期:&nbsp;</strong><span  class="ti">'+openDay+'</span>'+
           		'</p>'+
           		'</div>'+
       		'<div style="width:170px;float:left;margin-left:15px"><p style="font-size:14px;">'+
   			'<strong class="str">类型:&nbsp;</strong><span class="ti">'+type+'</span>'+
   		'</p>'+
   		'<p style="font-size:14px">'+
   			'<strong class="str">公开号:&nbsp;</strong><span class="ti">'+openNumber+'</span>'+
   		'</p>'+
   		'<p style="font-size:14px">'+
   			'<strong class="str">申请日期:&nbsp;</strong><span  class="ti">'+applyDay+'</span>'+
   		'</p>'+
   		'</div>'+
       	'</div></div>'+
		'<div class="right-pic">'+
   		'<p><img src='+imgUrl+' style="width:100px;height:100px"></p>'+
   '</div></div>'
       	StrAll+=conhtml;
        }
        $("#list").html(StrAll);
    }

    function paging(totalData, totalPage, pagenum) {
        $('#box').paging({
            initPageNo: pagenum, // 初始页码
            totalPages: totalPage, //总页数
            totalCount: '合计' + totalData + '条数据', // 条目总数
            slideSpeed: 600, // 缓动速度 单位毫秒
            jump: true, //是否支持跳转
            callback: function (page) {
                // 回调函数
            }
        });
    }

    function JumpToPage(pagenum) {
        if (pagenum > 500) {
            pagenum = 500
        }
        let typeName = $("#patentType option:selected").text();
        if (typeName == "不限") {
            typeName = "";
        }
        sendListData(typeName, pagenum);
    }
    var data = 
		[
		     ['车钥匙套', '4054'],
		     ['软件开发方法', '9410'],
		     ['网络设备', '6610'],
		     ['防火墙', '7130'],
		     ['游戏软件','8000'],
		     ['离合器','4760'],
		     ['机动车', '1670'],
		     ['网络技术', '2210'],
		     ['保险箱', '2980'],
		     ['护板', '1980'],
		     ['计算机', '1080']
			]
	createbar("barcontent","专利分布",data)
        $(document).ready(function() {
            $('.footable').footable();
        });
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
</body>
</html>
